#ifndef ENTITY_H_INCLUDED
#define ENTITY_H_INCLUDED

#include <SFML/Graphics.hpp>

typedef sf::FloatRect AABB;

class ItemEntity;

struct EntityData;

class Entity
{
public:

    Entity();

    virtual void tick();
    virtual void updateSprite();
    virtual bool collide(Entity* entity);

    virtual float getX();
    virtual float getY();
    virtual float getMotionX();
    virtual float getMotionY();
    virtual AABB getBoundingBox();
    virtual AABB getAbsoluteBoundingBox();
    virtual sf::Sprite* getSprite();

    virtual void setX(float);
    virtual void setY(float);
    virtual void setMotionX(float);
    virtual void setMotionY(float);

    virtual void onCollide(Entity*);
    virtual void takeHit(int, Entity*);
    virtual void pickup(ItemEntity*);

    void setRemove();
    bool doesNeedRemoval();

    virtual Entity* clone() = 0;

    virtual ~Entity();

    // Factory methods

    virtual Entity* setSprite(std::string);
    virtual Entity* setMass(float);
    virtual Entity* setSpeed(float);
    virtual Entity* setAABB(float, float);
    virtual Entity* setAABB(float, float , float , float);

protected:
    bool needsRemoval;
    EntityData* data;
    float x;
    float y;
    float motionX;
    float motionY;
    sf::Sprite sprite;
};


struct EntityData
{
    float mass;
    float speed;
    AABB aabb;
};

#endif // ENTITY_H_INCLUDED
